home *** CD-ROM | disk | FTP | other *** search
/ Night Owl 6 / Night Owl's Shareware - PDSI-006 - Night Owl Corp (1990).iso / 020a / bmp2bgi1.zip / BMP2BGI.TXT < prev    next >
Text File  |  1991-09-01  |  10KB  |  173 lines

  1. BMP2BGI: A utility to convert BMP graphic images to BGI format.
  2. Version: 1.0
  3. Date of Release: 6/25/91
  4. ===========================================================================
  5.  
  6. OVERVIEW:
  7.         This utility will convert 16-Color BMP images, like the ones drawn
  8. with MS Windows PAINT, to BGI format, so that the BGI image can be accessed
  9. through your Borland programs.  Any image of any size can be accommodated
  10. as long as its size does not exceed the size of your video card.  1024x768
  11. images will not be converted if your video card can only show 640x480.  
  12.  
  13.         The BMP images must be in uncompressed format, 16-color, and not
  14. created through OS/2.  These are the MS Windows 3.0 defaults.  A later
  15. version of BMP2BGI will support monochrome and 256-color images.
  16.  
  17.     The advantage of this utility is that now you can use a paint program,
  18. better than one you could create yourself, or use an already existing image.
  19. After converting the image to BGI, you can reference it in your Turbo Pascal,
  20. C, or C++ programs via the getimage() or putimage() functions.  I wrote this for 
  21. Turbo-C++ programmers, but enough code is provided that you can recode it for 
  22. Turbo Pascal.   I found this utility to be helpful for writing games, creating 
  23. neat-o title screens, and so forth.  Granted, BGI is not the fastest nor most 
  24. convenient of graphics system, but it's free.  Not many of us hobbyists can 
  25. afford the SFX graphics library.
  26.  
  27.     If you like my work, consider sending me $10 for my labor.  I'd be happy
  28. to send you the latest version on receipt of your honoria.  A nifty game w/ 
  29. graphics that you wrote yourself can be substituted.  Send either (both if 
  30. you're really enthusiastic, but I'd probably think you're weird--See the 
  31. section, "About the Author.") to the address at the end of this document.  If
  32. you use BMP2BGI in your own programming, don't worry about royalties;  I'm not 
  33. asking any.
  34.  
  35. INSTRUCTIONS FOR USING BMP2BGI:
  36.         BMP2BGI only works with images saved as files.  No support is made for
  37. "Cut-out" files, i.e., those you CUT or COPIED to.  After saving your BMP image 
  38. to a disk file, return to the DOS level, i.e.,  when you see the DOS prompt, 
  39. type:
  40.  
  41.                            BMP2BGI FName.BMP
  42.                 
  43. where 'FName.BMP'is the BMP file.  Next, you will see some statistics about
  44. your file, and EITHER an error message that explains why the image couldn't
  45. be translated OR a message that informs you that conversion will commence.
  46. The conversion is nondestructive, i.e., your BMP file will be unchanged.
  47.  
  48. Then you will see the image on-screen, followed by black-masking as the
  49. image is converted.  The image is saved in the file 'FName.BGI', where 'FName'
  50. is the same 'FName' as your BMP file.  If FName.BGI already exists, it is
  51. written over.
  52.  
  53.     To see how the image converted, a second program is included,
  54. SHOWBGI.EXE.  This program shows how the image converted.  To run, type
  55. the following on your DOS command line:
  56.  
  57.                     SHOWBGI FName.BGI
  58.  
  59. where 'FName.BGI' is the BGI file created with BMP2BGI.  SHOWBGI is a simple
  60. program in that it provides no error-checking, like if you entered a non-
  61. existing file.  NOTE: YOU CAN ONLY USE SHOWBGI WITH FILES CREATED FROM
  62. BMP2BGI.  Reason being is that I had to include some preliminary information
  63. about the color palette at the begining of the BGI images because of
  64. incompatibilities between Microsoft's and Borland's color palettes.  There are a 
  65. few shareware programs that also create BGI programs, but I found that their 
  66. file structure, similar to mine, contain preliminary information at the 
  67. beginning of the file.  More about this in the next section "PROGRAMMING FOR BGI 
  68. IMAGES."
  69.  
  70. PROGRAMMING FOR BGI IMAGES:
  71.     BMP2BGI was created primarily for programmers who want to use the
  72. Borland BGI toolkit for creating, displaying, and manipulating images they made
  73. with a program that creates BMP images.
  74.         If you are interested in reverse-engineering BMP2BGI, I made it easy
  75. for you; I included all source code and project files.  NOTE: if you want to
  76. tinker around w/ BMP2BGI: the source code is in Turbo C++ (v1.0) and you will
  77. need to write your own fexist(char *) function that returns TRUE if a file
  78. exists or FALSE otherwise.  Of course, you could comment out the part of the
  79. source code that calls fexist(), as this won't affect the translation.  Also,
  80. you will need to link two .OBJ files: EGAVGA.OBJ, which is in the \TC\BGI
  81. directory Turbo C created when it was installed.  Also, include the .OBJ file,
  82. EGAVGAF.OBJ, which you must create with the BGIOBJ.EXE program, also in the
  83. \TC\BGI directory.  EGAVGAF.OBJ is a BGI driver that allocates itself from the
  84. far heap.  I found it better to alloc from the far heap whenever I write large
  85. programs, as most games are.  If your preference is different, or you don't
  86. want to mess around w/ a "far" BGI driver, then amend the line 
  87. "registerfarbgidriver()" in the file, BMP2BGI2.C.  It is not crucial that the
  88. BGI driver be in far memory; it's just my preference.
  89.  
  90.         The BMP2BGI BGI file is not exactly pure BGI, as there is a header
  91. before the BGI bitmap images that contains various info.  Refer to BGI.H 
  92. (included w/ BMP2BGI) for an explanation.  IT IS IMPORTANT THAT YOUR BORLAND 
  93. PROGRAMS USE BGI.H TO ACCESS BGI IMAGES CREATED W/ BMP2BGI.  A sample program, 
  94. SHOWBGI.EXE, and accompanying source code is included to show you how.  Another 
  95. file, BMP.H, is included and is necessary for BMP2BGI, but not for programs 
  96. displaying BGI-transformed images.  BMP.H defines the file layout for BMP files.
  97.  
  98. ACKNOWLEDGEMENT:
  99. I acknowledge Charles Petzold's informative article on BMP bitmaps as giving 
  100. guidance if not outright variable names and BMP header structures.  If you are 
  101. interested in the BMP file, refer to Mr.Petzold's article in PC Magazine 
  102. (vol.10(10), pp365-370).
  103.  
  104. Included in this Zip-archive are the following files:
  105.  
  106. 0. This file:
  107.               BMP2BGI.Txt
  108.  
  109. 1. Turbo C++ source code for BMP2BGI:
  110.               bgi.h, bmp.h (Header files for BMP and BGI image files)              
  111.               bmp2bgi.c, bmp2bgi1.c, bmp2bgi2.c, bmp2bgi3.c
  112.               bmp2bgi.prj (The project file for BMP2BGI. Be sure to check
  113.                           the directories listed for the supplementary 
  114.                            files, as my programming subdirectories are probably 
  115.                            different from yours.  Also, check the 
  116.                            Options|Complier|Code Generation settings so as to
  117.                            set them for your preference.  I STRONGLY recommend 
  118.                            that you compile BMP2BGI as either a large- or huge- 
  119.                            memory program.  The buffer for the image file data 
  120.                            MUST be allocated from the far heap)
  121.  
  122.               
  123. 2. Turbo C++ source code for displaying BGI images created w/ BMP2BGI:
  124.               showbgi.c, showbgi2.c
  125.               showbgi.prj  (The project file for SHOWBGI.  Be sure to check
  126.                           the directories listed for the supplementary 
  127.                            files, as my programming subdirectories are probably 
  128.                            different from yours.  Also, check the 
  129.                            Options|Complier|Code Generation settings so as to
  130.                            set them for your preference.  I STRONGLY recommend 
  131.                            that you compile SHOWBGI as either a large- or huge- 
  132.                            memory program.  The buffer for the image file data 
  133.                            MUST be allocated from the far heap)
  134.  
  135. 3. Compiled Executables if you want to use the BMP2BGI or SHOWBGI right away and
  136.    don't want to tinker w/ reprogramming BMP2BGI.  Do check out SHOWBGI's
  137.    algorithms so you can learn how to use BGI image files in your programs.  If
  138.    it will help, feel free to cut-and-paste the algorithms.
  139.               bmp2bgi.exe, showbgi.exe     
  140.               
  141.  
  142. 4. And a sample BMP file:
  143.               test.bmp  (A 1/4th print screen from MS Windows, because I'm
  144.                     unartistic.)
  145.  
  146.         
  147. COPYRIGHTS (Because a lawyer suggested I do this):  
  148. ============================================================================
  149.  
  150. BMP.H: (c) Ziff-Davis Publishing
  151. BMP2BGI.EXE, SHOWBGI.EXE, BMP2BGI.c..BMP2BGI3.C, BGI.H, SHOWBGI.EXE, 
  152.         SHOWBGI.C, SHOWBGI2.C, TEST.BMP: (c) R.G.Rasulis Consulting Services
  153. MS Windows 3.0, MS Windows Paint, BMP: (c) Microsoft, Corp.
  154. Turbo C++, Turbo Pascal, Turbo C, BGI: (c) Borland International.
  155.       
  156. About the Author:
  157. ============================================================================
  158.  
  159. Richard Rasulis, Jr. is currently interning at the Milwaukee Mental Health
  160. Complex which partially fulfilling requirements for his doctoral degree in
  161. clinical psychology at the University of Montana.  Prior to becoming a
  162. "gradual" student, he worked as a hacker-4-hire in Boston, MA.  Amongst his
  163. hobbies is programming as well as conducting research on using computers
  164. to administer psychological tests.  He is the author of several PC programs,
  165. including scoring programs for various psychological tests.  Further, he is
  166. conducting research in the area of maturity and psychological well-being.
  167. He may be contacted through the various addresses:
  168.  
  169.         SnailNet: R.G.Rasulis                         PC-EXEC: Rich Rasulis
  170.                   c/o Dep't of Psychology             GEnie: R.RASULIS
  171.                   Milwaukee County Mental Health Complex
  172.                   Milwaukee, WI 53226
  173.